package main

import "fmt"

func main() {

	// 切片的底层是数组, 也是对数组的引用，改变其中一个，另一个随之改变
	var arr0 [3]int = [3]int{
		1, 2, 3,
	}
	var arr_list []int = arr0[0:2]
	fmt.Println(len(arr_list), cap(arr_list))
	fmt.Println(arr_list)

	arr_list[0] = -1

	// 切片会扩容2倍
	fmt.Println(arr_list, arr0)
	fmt.Println(len(arr_list), cap(arr_list))
	arr_list = append(arr_list, 3)
	fmt.Println(len(arr_list), cap(arr_list))
	arr_list = append(arr_list, 4)
	fmt.Println(len(arr_list), cap(arr_list))

	var arr []int = []int{
		1, 2, 3,
	}

	fmt.Println(arr)

	var arr1 = []int{
		1, 2, 3,
	}

	fmt.Println(arr1)

	arr2 := []int{
		1, 2, 3,
	}

	fmt.Println(arr2)

}
